package com.pan.io;

import com.pan.utils.ToStringUtils;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class ReadCSV {

    private Scanner scanner;

    private String limiter;

    public ReadCSV(File csvFile,String limiter){
        try {
            scanner = new Scanner(csvFile);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        this.limiter = limiter;
    }

    public String[] nextLine(){
        String s = scanner.nextLine();
        String[] arr = s.split(limiter);
        return arr;
    }

    public boolean hasNextLine(){
        return scanner.hasNextLine();
    }


    public void close(){
        scanner.close();
    }

}
